<?php 
include('../common/_const.php');
include('../common/common.php');
include('../common/checksession.php');
checksession("../index.php");
include('../../inc/conn.php');
date_default_timezone_set('Asia/Chongqing');//设置时区

$typeid=$_GET['catid'];
if(!$typeid){$typeid=0;}
isnum($typeid,"栏目id错误","catalog_main.php");
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $sys_title['add_article'] ?></title>
<link href="../images/css1/css.css" rel="stylesheet" type="text/css">
<script charset="utf-8" src="../../webeditor/kindeditor.js"></script>
<script type="text/javascript" src="../images/webcalendar.js"></script>
<script type="text/javascript">
 KE.scriptPath="../../webeditor/";
 KE.show({
                id : 'arc_content01',
				allowFileManager :true,
				resizeMode : 0,
				height : "420px",
				width : "100%",
				allowPreviewEmoticons : false,
				allowUpload : true,
				items : ['source', '|', 'fullscreen', 'undo', 'redo', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', '|', '-',
'title', 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold',
'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image',
'flash', 'media', 'advtable', 'hr', 'emoticons', 'link', 'unlink']
        });
</script>
<script type="text/javascript">
function checkform(o){
if(o.article_name.value==""){
	alert("请填写标题!");
	o.article_name.select();
	return false;
}
	
if(o.litpic.value!=""){	
	var fileid= o.litpic;
	var type=fileid.value.match(/^(.*)(\.)(.{1,8})$/)[3];
		type=type.toUpperCase();
	var img=new Image(); 
		img.src=fileid.value;

	if(type=="JPG" || type=="GIF"|| type=="JPEG" || type=="PNG"){
		//while(img.readyState != "complete"){alert("确认上传此图片？")}
		//if(img.readyState != "complete"){setTimeout("checkfile()",1000)}
		if(img.fileSize>614400){
			alert("图片不得大于600K,请重新上传！");
			return false;
		}
	}
	else{
	alert("上传类型有误,请正确上传图像文件！");
	fileid.select();
	fileid.focus();
	//window.location.reload();
	return false;
	}
}
}
</script>
</head>

<body>

<form action="../action/ac_article_add.php" method="post" enctype="multipart/form-data" onsubmit="return checkform(this)">
<table class="arc_t">
  <tr>
    <th colspan="4" align="left">
    <img src="../images/001.gif" width="14" height="14" style="margin:3px 8px 0px 8px" />
	<?php echo $sys_title['add_article'] ?>
    </th>
  </tr>
  <tr>
    <td width="113" align="right">文章标题：</td>
    <td colspan="3"><input type="text" name="article_name" class="cat_input" style="width:380px;" value="" /></td>
  </tr>
  <tr>
    <td align="right">定义属性：</td>
    <td colspan="3">
    <?php 
		$db=db_connect();
		$sql=select_sql("*","`".PRETABLE."arcatt`","1=1");
		$rs=$db->query($sql);
		while($row=$rs->fetch_assoc()){
	?>
    <input  type='checkbox' name='flags[]' value='<?php echo $row['att_id']; ?>'><?php echo $row['att_name']."[".$row['att_id']."]"; ?>
    <?php }  ?>
 </td>
  </tr>
  <tr>
    <td align="right">缩略图：</td>
    <td colspan="3" >
    <input type="file" name="litpic" class="cat_input" style="width:250px;" value="" />
   <span style="padding-left:20px; color:#F00; font-family:Arial;">*仅支持 .jpg .png .gif 且不能大于600K</span>
    </td>
  </tr>
  <tr>
    <td align="right">文章来源：</td>
    <td width="154" ><input type="text" name="source" class="cat_input" style="width:130px;" value="" maxlength="15" /></td>
    <td width="67" align="right"><span style="padding-left:8px;">作者：</span></td>
    <td width="388"><input type="text" name="auther" class="cat_input" style="width:130px;" value="" maxlength="15"/></td>
    </tr>
  <tr>
    <td align="right">文章栏目：</td>
    <td colspan="3">
     <select name="typeid" class="cat_slect" >
     	<?php 
			$sql_type=select_sql("`typename`,`id`","`".PRETABLE."arctype`","1=1");
			$rs=$db->query($sql_type) or die("datebase error!");
			while($type=$rs->fetch_assoc()){
		?>
     	<option value="<?php echo $type['id']; ?>" <?php if($type['id']==$typeid){echo "selected=\"selected\""; }?> ><?php echo $type['typename']; ?></option>
       <?php 
			}
			$rs->close();
			$db->close();
	   ?>
     </select>
    </td>
  </tr>
  <tr>
    <td align="right">关键字：</td>
    <td colspan="3"><input type="text" name="keywords" class="cat_input" style="width:380px;" value="" /></td>
  </tr>
  <tr>
    <td align="right">内容摘要：</td>
    <td colspan="3"><span class="td_bg">
      <textarea name="description" class="sys_area" style="margin-left:6px;"></textarea>
    </span></td>
  </tr>
  <tr>
    <th align="right">文章内容</th>
    <th colspan="3">&nbsp;</th>
  </tr>
  <tr>
    <td colspan="4" align="center">
    	<textarea id="arc_content01" name="arc_content" style="width:99%; height:150px;" ></textarea>
    </td>
  </tr>
  <tr>
    <th align="right">高级参数</th>
    <th colspan="3">&nbsp;</th>
  </tr>
   <tr>
    <td align="right">评论选项：</td>
    <td  >
   	  <input type="radio" name="feedback" id="feedback_y" value="1" /><label for="feedback_y">允许评论</label>
      <input type="radio" name="feedback" id="feedback_n" checked="checked" value="0"/><label for="feedback_n">禁止评论</label>
    </td>
    <td  align="right">浏览次数：</td>
    <td><input type="text" name="click" class="cat_input" style="width:130px;" value="80" /></td>
  </tr>
   <tr>
    <td align="right">发布时间：</td>
   <td >
   <input type="text" name="insert_time" class="cat_input" style="width:130px;" value="<?php echo date('Y-m-d'); ?>" onclick="SelectDate(this,'yyyy-MM-dd',80,0)" />
   </td>
    <td  align="right">文档状态：</td>
    <td>
    <select name="ishidden" class="cat_slect">
    	<option value="0" selected="selected">正常显示</option>
        <option value="1">隐藏</option>
    </select>
    </td>
  </tr>
   <tr>
    <td colspan="4" align="center">
      <input type="submit" name="submit" value="提交" class="btn" />
      <input type="reset" value="重置" class="btn" />
      <input type="hidden" name="gurl" value="<?php echo GetCurUrl(); ?>" /></td>
  </tr>
</table>
</form>
</body>
</html>